package com.weimob.kafka;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @program: xh-learn-record
 * @description:
 * @author: sch
 * @create: 2022-12-17 19:23
 **/
@Component
@Slf4j
public class KafkaConsumer {
    @KafkaListener(topics = {"my_test1"}, groupId = "test-consumer-group")
    public void receive(ConsumerRecord<?, ?> record) {
        // 消费的哪个topic、partition的消息,打印出消息内容
        log.info("简单消费：" + record.topic() + "-" + record.partition() + "-" + record.value());

    }
}
